package _07_priority_queue.my_implements;

import org.junit.Test;


/**
 * @author: mornd
 * @dateTime: 2023/6/8 - 1:36
 */
public class MyTest {

    @Test
    public void test() {
        PriorityQueue1<Entity> queue = new PriorityQueue1<>(5);
        queue.offer(new Entity("a", 1));
        queue.offer(new Entity("b", 3));
        queue.offer(new Entity("c", 5));
        queue.offer(new Entity("d", 4));
        queue.offer(new Entity("e", 4));
        queue.offer(new Entity("f", 6));

//        System.out.println(queue.peek());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.isEmpty());

        System.out.println(queue.iterator());
    }

    @Test
    public void test2() {
        PriorityQueue2<Entity> queue = new PriorityQueue2<>(5);
        queue.offer(new Entity("a", 1));
        queue.offer(new Entity("b", 3));
        queue.offer(new Entity("c", 5));
        queue.offer(new Entity("d", 4));
        queue.offer(new Entity("e", 4));
        queue.offer(new Entity("f", 6));

        System.out.println(queue);

//        System.out.println(queue.peek());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.isEmpty());

        queue.clear();
        System.out.println(queue);
    }

    @Test
    public void test3() {
        MaxHeap<Entity> queue = new MaxHeap<>(5);
        queue.offer(new Entity("a", 1));
        queue.offer(new Entity("b", 3));
        queue.offer(new Entity("c", 5));
        queue.offer(new Entity("d", 4));
        queue.offer(new Entity("e", 4));
        queue.offer(new Entity("f", 6));

//        System.out.println(queue.peek());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.isEmpty());
    }
}
